//
//  TTOrderStatusUtilis.m
//  TaoTuo
//
//  Created by admin on 2019/10/10.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTOrderStatusUtilis.h"

NSString *const orderCancelString = @"取消订单";
NSString *const orderProgressString = @"查看进度";
NSString *const orderDeleteString = @"删除订单";
NSString *const orderLookDetail = @"查看详情";

NSString *const orderPlaceString = @"立即下单";
NSString *const orderKefuString = @"联系客服";

@implementation TTOrderStatusUtilis

/// 由订单状态设置标题
+ (NSString *)getTitleByOrderStatus:(NSInteger)orderState
{
    NSString *title = @"";
    if (orderState == 10) {
        title = orderCancelString;
    } else if (orderState == 20 || orderState == 25 || orderState == 30 ||
            orderState == 35 || orderState == 40 || orderState == 45 ||
            orderState == 50 || orderState == 55 || orderState == 56 ||
            orderState == 60 || orderState == 65 || orderState == 70 || orderState == 75) {
        title = orderProgressString;
    } else {
        title = orderDeleteString;
    }
    return title;
}


+ (NSString *)getStatusTitleByOrderStatus:(NSString *)orderState
{
    return statusDic()[orderState];
}


static NSDictionary *statusDic() {
    
    return @{
        @"10" : @"待确认",
        @"20" : @"待采购",
        @"25" : @"采购在途",
        @"30" : @"待送厂",
        @"35" : @"加工中",
        @"40" : @"待调拨",
        @"45" : @"调拨在途",
        @"50" : @"待取货",
        @"55" : @"待送检",
        @"60" : @"待发货",
        @"65" : @"已发货",
        @"70" : @"待结算",
        @"75" : @"结算中",
        @"80" : @"客服关闭",
        @"81" : @"客户取消",
        @"90" : @"已完成",
        @"100" : @"退货",
        @"110" : @"换货"
    };
}




/// 由订单状态设置 个人店铺的 按钮标题
+ (NSArray *)getDianpuTitleByOrderStatus:(NSString *)orderState
{
    NSDictionary *dic = dianpuStatusDic()[orderState];
    return dic[@"btnTitles"];
}


/// 由订单状态设置 个人店铺的 标题文字
+ (NSString *)getDianpuStatusTitleByOrderStatus:(NSString *)orderState
{
    NSDictionary *dic = dianpuStatusDic()[orderState];
    return dic[@"title"];
}

static NSDictionary *dianpuStatusDic() {
    
    return @{
        @"0" : @{@"title" : @"待下单", @"btnTitles" : @[orderCancelString, orderLookDetail]},
        @"1" : @{@"title" : @"待完成", @"btnTitles" : @[orderKefuString]},
        @"2" : @{@"title" : @"已完成", @"btnTitles" : @[orderKefuString, orderDeleteString]},
        @"3" : @{@"title" : @"客服关闭", @"btnTitles" : @[orderKefuString]},
        @"4" : @{@"title" : @"客户取消", @"btnTitles" : @[orderKefuString]}
    };
    
}


@end
